# Replication Package for The underreported death toll of wars: a probabilistic reassessment from a structured expert elicitation

This replication package reproduces all main results reported in the paper, including every figure and table in both the main text and the appendix.

## Overview

The full replication can be executed via the shell script: `run_all_replication.sh`

This script runs all required R scripts in the correct order. Alternatively, each part of the analysis can be run independently using the individual R files contained in the repository. The scripts automatically install any required R packages that are not already present on the user's system. All necessary files are located in the .zip-file.

In addition to the scripts and data used to replicate the analysis, we also provide a set of 100 random draws for all events in the UCDP GED dataset (v23.1). These draws were generated using `uncertainUCDP` package, and are stored in the file: `UCDP_GED_v23.1_100draws.csv`. The script used to generate these draws is included in the replication package as: `generate_UCDP_draws.R`. Users interested in generating their own set of draws can run this script independently.

## Runtime and Computational Requirements

Running the full replication takes approximately 12 hours on a Mac M2 Pro (12 cores, 32 GB RAM). The runtime is almost entirely driven by the script: `optimize_and_test_distributions.R`, which performs the optimization and testing of the various probabilistic distributions. This script is parallelized to take advantage of multiple CPU cores. The more cores available, the faster this part of the replication will run. By default, the script will use all available cores minus one. To change this, modify line 21 in `optimize_and_test_distributions.R` that registers the parallel backend. Note: the script is set up to work on Unix-like operating systems (Linux, MacOS). Running on Windows may require additional modifications of the parallelization setup.

Important: `optimize_and_test_distributions.R` only needs to be run once. It saves intermediate result objects to disk, which are then reused by all subsequent scripts. If these objects are already present, the remaining scripts run comparatively quickly.

## Outputs

The replication package produces:
 - 2 data objects
 - 3 result objects
 - 10 figures
 - 10 tables

All outputs correspond exactly to those reported in the main text and appendix of the paper.

## Notes

Users who wish to inspect, modify, or rerun specific components of the analysis can do so by executing the relevant R scripts individually, provided that the required intermediate objects have already been generated.